import { ApiProperty } from "@nestjs/swagger"
import { IsNotEmpty, IsDefined, IsNumber, IsString } from "class-validator"

/*
 * @Description: 
 * @Author: fhw
 * @Date: 2023-01-29 16:15:25
 */
export class GroupChatMessageDto {
    @IsDefined({ message: '群聊ID不能为空' })
    @IsNotEmpty({ message: '群聊ID不能为空' })
    @IsString({ message: '群聊ID不是String类型' })
    @ApiProperty({
        type: String,
        name: 'group_id',
        description: '群聊ID',
    })
    public readonly group_id: string
    
    @IsNotEmpty({ message: '用户id不能为空' })
    @IsDefined({ message: '用户id不是为undefined或null' })
    @IsNumber()
    @ApiProperty({
      type: Number,
      name: 'userId',
      description: '用户id',
    })
    public readonly userId: number

    @IsNotEmpty({ message: '消息内容不能为空' })
    @IsDefined({ message: '消息内容不是为undefined或null' })
    @ApiProperty({
      type: String,
      name: 'content',
      description: '消息内容',
    })
    public readonly content: string
  
    @IsNotEmpty({ message: '文本类型不能为空' })
    @IsDefined({ message: '文本类型不是为undefined或null' })
    @IsNumber()
    @ApiProperty({
      type: Number,
      name: 'type',
      description: '文本类型：1是普通文本，2是图片，3是语音',
    })
    public readonly type: number
  }
  